#include "cfg_struct2json.h"
#include "gw.h"
#include "s2j.h"
#include "s2jdef.h"
#ifdef __cplusplus
extern "C" {
#endif

cJSON* struct_to_json_gw_param(void* struct_obj)
{
    s2j_create_json_obj(json_obj_);
	gw_param *struct_obj_ = (gw_param *)struct_obj;

    s2j_json_set_basic_element(json_obj_, struct_obj_, string, sn);
	s2j_json_set_basic_element(json_obj_, struct_obj_, double, runningStatus);
	s2j_json_set_basic_element(json_obj_, struct_obj_, double, uploadInterval);
	s2j_json_set_basic_element(json_obj_, struct_obj_, double, monitorNum);
	s2j_json_set_basic_element(json_obj_, struct_obj_, string, softVer);
	s2j_json_set_basic_element(json_obj_, struct_obj_, string, hardVer);
	
	return json_obj_;
}

void* json_to_struct_gw_param(cJSON* json_obj)
{
    s2j_create_struct_obj(struct_obj_, gw_param);
	s2j_struct_get_basic_element(struct_obj_,json_obj, string, sn);;
	s2j_struct_get_basic_element(struct_obj_,json_obj, int, runningStatus);
	s2j_struct_get_basic_element(struct_obj_,json_obj, int, uploadInterval);
	s2j_struct_get_basic_element(struct_obj_,json_obj, int, monitorNum);
    s2j_struct_get_basic_element(struct_obj_,json_obj, string, softVer);
	s2j_struct_get_basic_element(struct_obj_,json_obj, string, hardVer);
	return struct_obj_;
}

#ifdef __cplusplus
}
#endif /* end of __cplusplus */